All Questions
31 questions
3votes
2answers
2kviews
find -name -path
I have a some tree. . ├── 1 │ └── a │ └── script.a.sh ├── 2 │ └── a │ └── script.b.sh ... └── a └── script.sh And I need to find script.*.sh. I execute ./a/script.sh: #!/bin/bash #...
1vote
0answers
29views
Recursively remove certain folder from entire folder tree [duplicate]
Given a directory projects/ whose subfolders may have a venv/ folder at variable depths projects/foo/src/venv/ # venv/ at depth 2 projects/bar/venv/ # venv/ at depth 1 projects/baz/src/...
0votes
1answer
106views
find command, only execute when file is newer
I have a script that has the following steps: 1 mirror a remote server with lftp open ftps://'[name]':'[pwd]'@[remote_host] set ssl:check-hostname no mirror --delete-first --only-newer /...
0votes
2answers
122views
GNU find logical operators with -print
Consider the following file layout: . ├── dir_a │ └── file_1 └── file_2 Invoking find . \( -name dir_a -prune \) -a -print gives ./dir_a but invoking find . \( -name dir_a -prune \) -o -print ...
1vote
0answers
25views
Find directories that don't have a file with specified name [duplicate]
I've done a good amount of research on this and put together this command, but it appears to be finding the directories that HAVE scanned.txt not the directories that don't have scanned.txt. How can I ...
1vote
2answers
61views
How to handle with command to execute only it's subdirectory? [duplicate]
I'm looking for a way of execute command which I can execute some command only under sub directory not command affect to current directory. find -name ":RUN" -exec rm -rf {} \; If I got a ...
0votes
1answer
152views
Look for all files named temp
I’m supposed to look for all files named temp. Would I just do: find . -name "temp" Then I’m supposed to make sure no error messages pop up Would I just add the 2>/dev/null at the end of the ...
0votes
3answers
61views
can I replace a string in two different files with one command?
I have a directory that contains some subdirectories. I know there are two types of files, such as *A*.txt and *B*.txt, contain an "oldString" under that directory. I want to replace them with a "...
1vote
1answer
194views
Copy files such that individual files gets copied to the folder having file name as a string within complete folder name
I am using Cygwin as Linux shell, I have following contents in my current working directory: Files : Abc.dat 123.dat 456.dat Directories: W_Abc_w W_123_w W_456_w Now I want to copy files as ...
-1votes
3answers
886views
How to list all files that end in ".doc" that exist in a directory and subdirectories whose name contain a certain word WITHOUT piping? [closed]
For example, If I have a directory called Test and it has a file named test.doc and String and a subdirectory Tests with doc2.doc So the output in this case would just be test.doc because the ...
1vote
2answers
293views
How to save the progress of the "find" command?
I have big directory tree of files. I often use the find command to locate something in that tree. The first time after a reboot it takes some time, but subsequent uses are almost instant. Obviously ...
0votes
2answers
1kviews
Recursively replace path in a files in directory, except binary files
How to recursively replace strings (location path) in the files in directory, except binary files? I tried command find . -type f -exec sed -i 's/foo/bar/g' {} + but it replaces also strings in ...
4votes
2answers
4kviews
Find the longest file name
I have to find the symbolic link which contains the longest folder name in a folder full of symbolic links. So far I have this: find <folder> -type l -printf "%l\n" I was wondering if there's ...
5votes
1answer
6kviews
find and symbolic link
I was skimming over the documentation of find to better utilize the command usage. I was reading the part that says GNU find will handle symbolic links in one of two ways; firstly, it can ...
1vote
2answers
84views
convert the dates to a standard format
I am using this command, find -name (file name) -ls | awk '{print $11,"\t",$5,"\t",$7,"\t",$8,$10}' to gather information of tons of files. However, some files are giving us weird numbers where ...